<extend name="Public/common"/>
<block name="othercss">
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>

</block>
<block name="header">
</block>
<block name="body">
    <!--header-->
    <div class="header">
        <div class="clearfix box">
            <!--<a class="save">保存</a>-->
            <a class="return" href="{:urlrotue('Member/myorder')}"><i class="return-icon"></i></a>
            <h2>确认订单</h2>
        </div>
    </div>
    <!--end header-->
    <div class="container pt50" style="background: #f5f5f5">
        <div class="zf1_title">
            {$title}<br>订单金额：<span class="price">{$total_need_pay|priceTofixed}</span> 元
        </div>
        <div class="zf1_name">
            <div class="right">七金珠宝商城</div>
            收款方：
        </div>
        <a class="zf1_btn" onClick="goweixin()">立即支付</a>
    </div>

</block>
<block name="otherjs">
    <script>
        function onBridgeReady(){
            let data = JSON.parse('{$pay_data}');
            WeixinJSBridge.invoke(
                'getBrandWCPayRequest', {
                    "appId": data.appId,
                    "nonceStr":data.nonceStr,
                    "package": data.package,
                    "paySign": data.paySign,
                    "signType": data.signType,
                    "timeStamp": data.timeStamp
                },
                function(res){
                    // alert(res.err_code + res.err_desc + res.err_msg);
                    if(res.err_msg == "get_brand_wcpay_request:ok" ){
                        window.location.href = '/Phone/Member/myorder';
                    }
                });
        }

        function goweixin() {
            if (typeof WeixinJSBridge == "undefined"){
                if( document.addEventListener ){
                    document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
                }else if (document.attachEvent){
                    document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
                    document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
                }
            }else{
                onBridgeReady();
            }
        }
    </script>

</block>
